/* ProfilePage.css - 个人中心页面组件样式 */

.profile-container {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-xl);
    max-width: 1000px;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-xl);
}

.profile-title h1 {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-white);
    margin-bottom: var(--spacing-sm);
}

.profile-title p {
    color: var(--text-gray-light);
}

.edit-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--primary-purple);
    color: var(--text-white);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-btn:hover {
    background: var(--purple-dark);
    transform: translateY(-1px);
}

.profile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
}

.profile-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-white);
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: var(--spacing-sm);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-gray-light);
}

.info-label {
    font-weight: 500;
    min-width: 100px;
}

.info-value {
    color: var(--text-white);
}

.info-input {
    padding: var(--spacing-xs) 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-white);
    font-size: 0.875rem;
}

.info-input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.5);
}

.bio-section {
    color: var(--text-gray-light);
}

.bio-text {
    color: var(--text-white);
    margin-top: var(--spacing-sm);
    padding: 0.75rem;
    background: var(--bg-glass-light);
    border-radius: var(--radius-md);
}

.bio-textarea {
    width: 100%;
    margin-top: var(--spacing-sm);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-white);
    resize: none;
    min-height: 80px;
    font-family: inherit;
}

.bio-textarea:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.5);
}

.save-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--success);
    color: var(--text-white);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.save-btn:hover:not(:disabled) {
    background: var(--success-dark);
    transform: translateY(-1px);
}

.save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 头像样式 */
.avatar-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-gray-light);
    margin-bottom: var(--spacing-md);
}

.avatar-container {
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-glass);
    background: var(--bg-glass-light);
}

.avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-glass-light);
    border: 2px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-gray-light);
    font-size: 0.75rem;
    gap: 0.25rem;
}

.avatar-placeholder span:first-child {
    font-size: 1.5rem;
}

.loading-spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-glass);
    border-top: 2px solid var(--primary-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Passkey 样式 */
.passkey-card {
    background: var(--bg-glass-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.passkey-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text-white);
}

.passkey-display {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.passkey-value {
    flex: 1;
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-white);
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.copy-btn {
    background: var(--primary-purple);
    color: var(--text-white);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background: var(--purple-dark);
    transform: scale(1.05);
}

.passkey-loading,
.passkey-placeholder {
    color: var(--text-gray-light);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0.75rem;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: var(--bg-glass-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: var(--bg-glass);
    transform: translateY(-1px);
}

.stat-icon {
    width: 2rem;
    height: 2rem;
    margin: 0 auto var(--spacing-sm);
    font-size: 1.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-white);
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-gray-light);
}

/* 邀请码卡片 */
.invite-card {
    background: var(--bg-glass-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.invite-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: 0.75rem;
}

.invite-header span {
    font-weight: 500;
    color: var(--text-white);
}

.invite-code-display {
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.invite-code-label {
    font-size: 0.875rem;
    color: var(--text-gray-light);
    margin-bottom: var(--spacing-xs);
}

.invite-code-value {
    font-size: 1.125rem;
    font-family: monospace;
    color: var(--text-white);
    font-weight: bold;
}

.invite-placeholder {
    color: var(--text-gray-light);
    margin-bottom: 0.75rem;
}

.invite-btn {
    width: 100%;
    padding: var(--spacing-sm);
    background: var(--primary-purple);
    color: var(--text-white);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.invite-btn:hover:not(:disabled) {
    background: var(--purple-dark);
}

.invite-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 消息样式 */
.message {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    font-weight: 500;
}

.message.success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.message.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* 加载状态 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-gray-light);
    gap: var(--spacing-md);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-glass);
    border-top: 3px solid var(--primary-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .profile-content {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .profile-header {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: stretch;
    }

    .info-item,
    .avatar-section {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    .info-label {
        min-width: auto;
    }

    .passkey-display {
        flex-direction: column;
        align-items: stretch;
    }

    .passkey-value {
        text-align: center;
        white-space: normal;
        word-break: break-all;
    }

    .copy-btn {
        align-self: center;
    }
}

@media (max-width: 480px) {
    .profile-container {
        padding: var(--spacing-md);
    }

    .profile-title h1 {
        font-size: 1.75rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .user-avatar,
    .avatar-placeholder {
        width: 60px;
        height: 60px;
    }

    .avatar-placeholder span:first-child {
        font-size: 1.25rem;
    }
}

.new-user-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: linear-gradient(45deg, #ff9a9e, #fad0c4);
    color: #fff;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.user-level-card {
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.level-info {
    padding: 20px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.level-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.level-number {
    font-size: 2em;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.level-name {
    font-size: 1.2em;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.level-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 1.1em;
}

.level-score, .level-discount {
    background: rgba(255,255,255,0.1);
    padding: 8px 16px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

@media (max-width: 768px) {
    .level-info {
        flex-direction: column;
        text-align: center;
    }

    .level-details {
        width: 100%;
    }
}